/*
 * 本代码实现了列表的复写设计
 */
package com.bf.zk.table;

import javax.swing.JTable;
import javax.swing.table.TableCellEditor;

public class UserTable extends JTable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	int myRow = -1, myCol = -1;
	TableCellEditor myEditor;// 边框编辑器

	public void setComboCell(int row, int col, TableCellEditor editor) {
		this.myRow = row;
		this.myCol = col;
		this.myEditor = editor;
	}

	// 编辑列表
	public TableCellEditor getCellEditor(int row, int col) {
		if (row == myRow && col == myCol && myEditor != null)
			return myEditor;
		return super.getCellEditor(row, col);
	}

	// 返回数据类型
	public Class<? extends Object> getColumnClass(int myCol) {
		return getValueAt(0, myCol).getClass();
	}

	// 可编辑性
	public boolean isCellEditable(int rowindex, int colindex) {
		if (0 == colindex)
			return true;
		return false;
	}
}
